package java02;

import java.util.Random;

//作1：   int [] arr={1,2,3,4,5};  要求打乱顺序
public class java02_7 {
    public static void main(String[] args) {
        int[] arr = {1,2,3,4,5};
        Random rand = new Random();
        int a = rand.nextInt(arr.length);
        System.out.println("随机数:"+a);
        for (int i = 0; i<=a; i++,a--) {
      int c=arr[i];
     arr[i]=arr[a];
     arr[a]=c;
        }
        for (int i = 0; i< arr.length; i++) {
            System.out.println(arr[i]);
        }
    }
}
